﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FallingWordsGame;
using FallingWordsGame.Interfaces;

namespace FallingWordsTest
{
    [TestClass]
    public class WordManipulatorTest
    {
        [TestMethod]
        public void MatchFirstLowerCharTest1()
        {
            Word word = new Word("Word");
            char inputChar = 'o';

            Assert.IsTrue(WordManipulator.MatchFirstLowerChar(word, inputChar));
        }

        [TestMethod]
        public void MatchFirstLowerCharTest2()
        {
            Word word = new Word("WO rd");
            char inputChar = ' ';

            Assert.IsTrue(WordManipulator.MatchFirstLowerChar(word, inputChar));
        }

        [TestMethod]
        public void MatchFirstLowerCharTest3()
        {
            Word word = new Word("wo rd");
            char inputChar = 'w';

            Assert.IsTrue(WordManipulator.MatchFirstLowerChar(word, inputChar));
        }

        [TestMethod]
        public void MatchFirstLowerCharTest4()
        {
            Word word = new Word(" word");
            char inputChar = ' ';

            Assert.IsTrue(WordManipulator.MatchFirstLowerChar(word, inputChar));
        }

        [TestMethod]
        public void MatchFirstLowerCharTest5()
        {
            Word word = new Word("WORd");
            char inputChar = 'd';

            Assert.IsTrue(WordManipulator.MatchFirstLowerChar(word, inputChar));
        }

        [TestMethod]
        public void MakeFirstLowerToUpperTest1()
        {
            var word = new Word("Word");
            WordManipulator.MakeFirstLowerToUpperChar(word);

            var expected = "WOrd";
            var actual = word.Text;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void MakeFirstLowerToUpperTest2()
        {
            var word = new Word("WO rd");
            WordManipulator.MakeFirstLowerToUpperChar(word);

            var expected = "WO@rd";
            var actual = word.Text;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void MakeFirstLowerToUpperTest3()
        {
            var word = new Word("WO@RD@IS@up");
            WordManipulator.MakeFirstLowerToUpperChar(word);

            var expected = "WO@RD@IS@Up";
            var actual = word.Text;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void ToLowerTest1()
        {
            var word = new Word("WO@rd");
            WordManipulator.ToLower(word);

            var expected = "wo rd";
            var actual = word.Text;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void ToLowerTest2()
        {
            var word = new Word("wo rd");
            WordManipulator.ToLower(word);

            var expected = "wo rd";
            var actual = word.Text;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void ToLowerTest3()
        {
            var word = new Word("WO@RD");
            WordManipulator.ToLower(word);

            var expected = "wo rd";
            var actual = word.Text;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void ToLowerTest4()
        {
            var word = new Word("word");
            WordManipulator.ToLower(word);

            var expected = "word";
            var actual = word.Text;

            Assert.AreEqual(expected, actual);
        }

        [TestMethod]
        public void IsCurrentSpaceTest1()
        {
            var word = new Word("WO rd");
            Assert.IsTrue(WordManipulator.IsCurrentSpace(word));
        }

        [TestMethod]
        public void IsCurrentSpaceTest2()
        {
            var word = new Word("Wo rd");
            Assert.IsFalse(WordManipulator.IsCurrentSpace(word));
        }
    }
}
